package cn.qingfeng.a003_chat_v2_1.javafxview;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class QQDialogApp extends Application {

    public static QQDialogController controller;

    @Override
    public void start(Stage primaryStage) throws Exception {
//        Parent root = FXMLLoader.load(getClass().getResource("/fxml/QQDialog.fxml"));

        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/QQDialog.fxml"));
        Parent root = loader.load();// 确保先调用 root()
        System.out.println("chat:" + root);
        controller = loader.getController(); // 获取控制器实例

        System.out.println("app:" + root);
        Scene scene = new Scene(root, 800, 800);
        primaryStage.setTitle("QQ对话框示例");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}